Artikel onlineArtikel online

Einführung in REBOL

Dies ist das Beispiel-Listing Geburtstage zum Artikel Einführung in REBOL von Robbie Schäfer. Sie können diese Online-Version (ohne Zeilennummern) auch für den eigenen Gebrauch downloaden.

 1: REBOL [
 2:   Title: "Geburtstage"
 3:   Date:  1999/1/5
 4:   File: %geburtstage.r
 5:   Version: 1.0
 6:   Zweck: "Sendet Geburtstagsgrüße zu meinen Freunden"
 7: ]
 8: 
 9: choice: 3
10: if (exists? %friends.dat) [ friends: load %friends.dat ]
11: else [ friends: [] ]
12: 
13: displayMenu: func []
14: [
15:   print "^/   Bitte wählen Sie:^/"
16:   print "   1 - Freund hinzufügen"
17:   print "   2 - Freund löschen"
18:   print "   3 - Alle Freunde anzeigen"
19:   print "   4 - Geburtsdaten überprüfen^/"
20:   print "   0 - Speichern und verschwinden^/"
21:   prin "   Ihre Wahl: "
22: ]
23: 
24: addFriend: func []
25: [
26:   print "^/Freund hinzufügen:^/"
27:   prin "Name    : "
28:   name: make string! input
29:   prin "Vorname : "
30:   vorname: make string! input
31:   prin "e-mail  : "
32:   email: make email! input
33:   prin "Geburtstag: "
34:   geburtstag: make date! input
35:   print""
36: 
37:   insert tail friends make block! [name vorname email geburtstag]
38: ]
39: 
40: deleteFriend: func []
41: [
42:   print "^/Freund Löschen:^/"
43:   prin "e-mail des Freundes: "
44:   email: make email! input
45:   remove/part (skip find friends email -2) 4
46: ]
47: 
48: showFriends: func []
49: [
50:   print "^/Alle Einträge in der Datenbank:^/"
51:   forskip friends 4 
52:   [
53:     print  [first friends "" second friends "" third friends "" fourth friends]
54:   ]
55: ]
56: 
57: checkDates: func []
58: [
59:   print "^/Mal schauen wer heute Geburtstag hat...^/"
60:   today: make date! reduce [first now second now third now]
61:   forskip friends 4
62:   [
63:     birthday: make date! fourth friends
64:     if ((first birthday) = (first today)) and ((second birthday) = (second today)) 
65:     [
66:        print [second friends "hat Geburtstag!! Sende Glückwünsche..."]
67:        send third friends "Happy Birthday"
68:        print "fertig!"
69:     ]
70:   ]
71: ]
72: 
73: while [choice "0"]
74: [
75:   displayMenu
76:   choice: input
77:   if choice = "1" [addFriend]
78:   if choice = "2" [deleteFriend]
79:   if choice = "3" [showFriends]
80:   if choice = "4" [checkDates]
81: ]
82: 
83: save %friends.dat friends
84: quit

© 1998-2000 thomas raukamp communications.
All rights reserved. Webmaster: Nico Barbat.